package com.five.taotao.Application;

import android.app.Application;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.content.SharedPreferences;


import com.five.taotao.selfwidget.SelfToast;
import com.five.taotao.util.VolleyUtil;
import com.zhy.http.okhttp.OkHttpUtils;

import java.io.File;
import java.util.concurrent.TimeUnit;

import okhttp3.OkHttpClient;

/**
 * Created by asus on 2016/11/1.
 */
public class MyApplication extends Application {
    private Bitmap bitmap;

    public Bitmap bitmap() {
        return  bitmap;
    }
    public void setBitmap(Bitmap b) {
        bitmap = b;
    }

    public static SelfToast toast;//自定义Toast

    public static  String userId;//用户id


    @Override
    public void onCreate() {
        super.onCreate();
        //网络请求
        VolleyUtil.init(this);//初始化requestQueue 对象 只实例化一次

        //配置okhttp请求
        OkHttpClient okHttpClient = new OkHttpClient.Builder()
                //.addInterceptor(new LoggerInterceptor("TAG"))
                .connectTimeout(10000L, TimeUnit.MILLISECONDS)
                .readTimeout(10000L, TimeUnit.MILLISECONDS)
                .build();
        //初始化okhttp请求
        OkHttpUtils.initClient(okHttpClient);

        toast = new SelfToast(getApplicationContext());

        //初始化用户信息
        SharedPreferences sp = getSharedPreferences("user",MODE_PRIVATE);
        userId = sp.getString("userId","");

    }

}
